<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport"/>
    <meta content="yes" name="apple-mobile-web-app-capable"/>
    <meta content="black" name="apple-mobile-web-app-status-bar-style"/>
    <meta content="telephone=no" name="format-detection"/>
    <meta charset="UTF-8">
    <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport"/>
    <meta content="yes" name="apple-mobile-web-app-capable"/>
    <meta content="black" name="apple-mobile-web-app-status-bar-style"/>
    <meta content="telephone=no" name="format-detection"/>
    <!--引入初始化样式-->
    <link rel="stylesheet" href="../../b2c/lib/css/style-min.css">
    <!--引入YUDI样式-->
    <link rel="stylesheet" href="../../b2c/lib/css/ydui.css">
    <!--引入YUDI自适应解决方案类库-->
    <script src="../../b2c/lib/js/flexible/flexible.js"></script>
    <!-- 引入jQuery 2.0+ -->
    <script src="../../b2c/lib/js/jquery/jquery-2.1.4.min.js"></script>
    <!-- 引入common -->
    <script src="../lib/js/common/common.js"></script>
    <!-- 引入vue -->
    <script src="../../b2c/lib/js/vue/vue.min.js"></script>
    <!--引入对应的css-->
    <link rel="stylesheet" href="../css/user/getOpenid.css">
</head>
<body class="register-body" style="background-color: #eee">
<!--登录已过期-->
<div class="again-access-token">
    <img class="img" src="../images/system_error.png">
    <p>获取openid失败！</p>
    <div class="btn">
        <a href="javascript:;" class="weui_btn weui_btn_primary" onclick="againAccessToken()">返回首页</a>
    </div>
</div>
<script src="../lib/js/ydui.js"></script>
<script type="text/javascript">
    function  PageInit() {
        if($.getPara('code')==''){
            //获取Code
            $.GetWXCode();
        }else {
            if($.getStorage('xmOpenid')){
                if($.getPara('flag')=='goods'){
                }else if($.getPara('flag')=='shop'){
                }

                window.history.go(-2);
//                location.href = '../b2c/pay/goodsPay.html';
            }else{
                $.GetAccessToken(); //获取OpenId

            }
//            if($.getStorage('xmOpenid')){
//
//
////                    if($.getPara('flag')=='goods'){
////                    }else if($.getPara('flag')=='shop'){
////                    }
//////
//////                    window.history.go(-2);
////                location.href = '../b2c/pay/goodsPay.html';
//                console.log($.getStorage("openUrl"))
//
//                if($.getStorage("openUrl").indexOf('inviterUserId')>-1){
////                    var obj={};
////                    obj.openId=result.data.undefinedId;
////                    $.setStorage("xm_uData",obj);
//                    window.location.href=$.getStorage("openUrl");
//                }else if($.getStorage("openUrl").indexOf('storeId')>-1){
////                    var obj={};
////                    obj.openId=result.data.undefinedId;
//                    window.location.href=$.getStorage("openUrl");
//
//                }else if($.getStorage("openUrl").indexOf('recommendFrom')>-1){
////                    var obj={};
////                    obj.openId=result.data.undefinedId;
////                    $.setStorage("xm_uData",obj);
//                    window.location.href=$.getStorage("openUrl")
//                }else if($.getPara('flag')=='goods'){
//
//                }else if($.getPara('flag')=='shop'){
//
//                }else{
//                    window.location.href = '../pay/goodsPay.html';
//                }
//
//            }else{
//                $.GetAccessToken(); //获取OpenId
//
//            }
        }
    }
    function appInit() {
        PageInit();
    }
//    function againAccessToken() {
//        $.delStorage("hx_wx");
//        $.delStorage("hx_AccessTokenIndex");
//        $.delStorage("wx");
//        $.delStorage("uData");
//        $.delStorage("AccessTokenIndex");
//        window.location.href='/';
//    }
</script>
</body>
</html>
